﻿using SLClient.ViewModels;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;

namespace SLClient.Views
{
    public partial class MainpageView : UserControl
    {       

        public MainpageView()
        {
            this.InitializeComponent();
            base.DataContext=new MainpageViewModel();
        }

        private void btnFun_Click(object sender, RoutedEventArgs e)
        {
            this.dgBetDealInfo.Visibility = Visibility.Collapsed;
            Control control = sender as Control;
            this.NavgationTo(control.Tag.ToString());
        }

        private void btnNavgation_Click(object sender, RoutedEventArgs e)
        {
            this.dgBetDealInfo.Visibility = Visibility.Visible;
            Control control = sender as Control;
            this.NavgationTo(control.Tag.ToString());
        }


        private void NavgationTo(string tag)
        {
            string uriString = string.Format("/SLClient;component/Views/{0}.xaml", tag);
            this.ContentFrame1.Source = new Uri(uriString, UriKind.Relative);
        }

        private void TextBlock_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            (base.DataContext as MainpageViewModel).ShowUserPlayInfo();
        }
    }
}
